// app.js

import {
    login
} from './utils/api'

App({
    onLaunch() {
        // 展示本地存储能力
        const logs = wx.getStorageSync('logs') || []
        logs.unshift(Date.now())
        wx.setStorageSync('logs', logs)

        /**
         * 用户登录
         */
        wx.login({
            success: res => {
                login({
                    code: res.code
                }).then(res => {
                    wx.setStorageSync('openId', res.data.openId)
                })
            }
        })
    },
    globalData: {
        userInfo: null,
        salt: 'taoym1326'
    }
})